package com.cashmama.market.api.application.controller.order.request;

import com.cashmama.market.api.infras.exception.ApplicationException;
import com.cashmama.market.api.infras.utils.StringUtils;
import com.fqgj.common.api.ParamsObject;

import java.util.List;


public class ProductVO extends ParamsObject {

    /**
     * 商户号
     */
    private String merchantCode;
    /**
     * 产品code
     */
    private String productCode;

    private Integer usageOfLoan;

    /**
     * 当前wifi信息
     */
    private UserWifiVO currentWifi;

    /**
     * 附近wifi信息
     */
    private List<UserWifiVO> nearbyWifis;

    public String getMerchantCode() {
        return merchantCode;
    }

    public ProductVO setMerchantCode(String merchantCode) {
        this.merchantCode = merchantCode;
        return this;
    }

    public Integer getUsageOfLoan() {
        return usageOfLoan;
    }

    public ProductVO setUsageOfLoan(Integer usageOfLoan) {
        this.usageOfLoan = usageOfLoan;
        return this;
    }

    public UserWifiVO getCurrentWifi() {
        return currentWifi;
    }

    public void setCurrentWifi(UserWifiVO currentWifi) {
        this.currentWifi = currentWifi;
    }

    public List<UserWifiVO> getNearbyWifis() {
        return nearbyWifis;
    }

    public void setNearbyWifis(List<UserWifiVO> nearbyWifis) {
        this.nearbyWifis = nearbyWifis;
    }

    public String getProductCode() {
        return productCode;
    }

    public void setProductCode(String productCode) {
        this.productCode = productCode;
    }

    @Override
    public void validate() {
        if(StringUtils.isEmpty(merchantCode)) {
            throw new ApplicationException("merchantCode can not be empty");
        }
        if(StringUtils.isEmpty(productCode)){
            throw new ApplicationException("Product can not be empty");
        }
        if(usageOfLoan == null){
            throw new ApplicationException("usageOfLoan can not be empty");
        }
    }
}
